<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>animation</title>
    <style>
        @keyframes myAnimation {
            0%{
                background-color: red;
                left:0px;
            }
            50%{
                background-color: yellow;
                left:50px;
            }
            100%{
                background-color: green;
                left:100px;
            }
        }
        #box{
            width:100px;
            height:100px;
            position: relative;
            animation: myAnimation 3s ease 0s;
        }
    </style>
</head>
<body>
    <div id="box"></div>
    <script>
        let box = document.getElementById('box');
        box.addEventListener('animationend',()=>{
            alert(`动画执行完毕`);
        });
    </script>
</body>
</html>